<?php
$section = "member";
$titre = _LB_LOGIN;
$link = $section;
if(isMemberLoggedIn()){
	redirect(APPLICATION_URL_FO."/");
}
//get object ID
$id = Request::getIntNumber('id');
$act = Request::getIntNumber('act');
if ($act == ACT_VALID_EDIT)
{
	$login = $_POST['login'];
	$pwd = $_POST['pwd'];
	$acces = new Member();
	$acces->whereAdd("EMAIL = '" . mysql_real_escape_string($login) . "'");
	$acces->whereAdd("PASS = '" . sha1(mysql_real_escape_string($pwd)) . "'");


	$acces->DISABLED = 0;
	$acces->find();
   
	if ($acces->fetch()){
		$acces->updateMember();
		$_SESSION["memberID"] = $acces->ID;
		if(isset($_SESSION['bookingData']) && $_SESSION['bookingData'] != "" && is_array(unserialize($_SESSION['bookingData']))){
			redirect(APPLICATION_URL_FO."/booking/preview/");
		}
		else{
			redirect(APPLICATION_URL_FO."/");
		}
	}
	else{
	}
}
//create cfer
$cfer = new Cfer(array(
	_LB_ACCUEIL => APPLICATION_URL_FO,
	_LB_LOGIN => Utils::getCurrentLink()));

//if validate is false, display form again
$smarty->assign('cfer', $cfer);
$smarty->display('member_login.html');
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

